package com.huanying.goodjob.job;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.huanying.framework.user.User;
import com.huanying.goodjob.community.Area;

@Entity
@Table(name = "job")
public class Job implements Serializable {

	private static final long serialVersionUID = -657999628176113432L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private int id;

	@OneToOne(cascade = CascadeType.ALL)
	@NotFound(action = NotFoundAction.IGNORE)
	@JoinColumn(name = "user_id")
	private User user; // 发布人
	
	@OneToOne(cascade = CascadeType.ALL)
	@NotFound(action = NotFoundAction.IGNORE)
	@JoinColumn(name = "area_code")
	private Area area; // 区域
	
	private String community; // 小区
	
	private String address; //地址
	
	private String building;  // 栋
	private String cell;  // 单元
	private String number;  // 门牌号 
	
	private int decoration_type;  //装修类型
	private Date create_time; // 发布时间
	
	@Column(name = "release_status", nullable = false, columnDefinition = "INT default 0")
	private int release_status; // 发布状态
	
	@Column(name = "job_status", nullable = false, columnDefinition = "INT default 0")
	private int job_status; // 工作状态
	
	@Column(name = "status", nullable = false, columnDefinition = "INT default 1")
	private int status; // 状态

	@OneToMany(cascade = CascadeType.ALL, mappedBy = "job", fetch = FetchType.EAGER)
	@NotFound(action = NotFoundAction.IGNORE)
	private transient List<Jobitem> jobitems;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Area getArea() {
		return area;
	}

	public void setArea(Area area) {
		this.area = area;
	}

	public String getCommunity() {
		return community;
	}

	public void setCommunity(String community) {
		this.community = community;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getBuilding() {
		return building;
	}

	public void setBuilding(String building) {
		this.building = building;
	}

	public String getCell() {
		return cell;
	}

	public void setCell(String cell) {
		this.cell = cell;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public int getDecoration_type() {
		return decoration_type;
	}

	public void setDecoration_type(int decoration_type) {
		this.decoration_type = decoration_type;
	}

	public Date getCreate_time() {
		return create_time;
	}

	public void setCreate_time(Date create_time) {
		this.create_time = create_time;
	}

	public int getRelease_status() {
		return release_status;
	}

	public void setRelease_status(int release_status) {
		this.release_status = release_status;
	}

	public int getJob_status() {
		return job_status;
	}

	public void setJob_status(int job_status) {
		this.job_status = job_status;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public List<Jobitem> getJobitems() {
		return jobitems;
	}

	public void setJobitems(List<Jobitem> jobitems) {
		this.jobitems = jobitems;
	}

}
